cmake_minimum_required(VERSION 3.14)

project(QQuickRO LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
message("--version" Qt${QT_VERSION_PATCH})

function(getQtPrivate module output)
set(QT_INCLUDE_PATH ${QT_DIR}/../../../include)
set(privatePath "${QT_INCLUDE_PATH}/Qt${module}/${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
set(${output}
${privatePath}
${privatePath}/Qt${module}
 PARENT_SCOPE)
endfunction()



message("---QT_CORE_PRIVATE" ${QT_CORE_PRIVATE})
add_library(QQuickRO SHARED
	QQuickRO_global.h
	ROComponent.cpp
	ROComponent.h
	RONode.cpp
	RONode.h
	ROProperty.cpp
	ROProperty.h
	RORPC.cpp
	RORPC.h
	QQuickRO.cpp
)

target_include_directories(QQuickRO PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${QT_CORE_PRIVATE}
${QT_CORE_PRIVATE}/QtCore
"../QRemoteObjectAdvance"
)

target_link_libraries(QQuickRO PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick QRemoteObjectAdvance)

target_compile_definitions(QQuickRO PRIVATE QQuickRO_LIBRARY)
